package com.waiting.collection;

import java.util.Collections;
import java.util.List;

/**
 * @author bjweitingting
 * @description
 * @date 2018/9/6
 **/
public class SingletonList {
    public static void main(String[] args) {
        String groupId = "eee";
        List<String> result = Collections.singletonList(groupId);
        for (String item : result) {
            System.out.println(item);
        }
        //Collections.singletonList(something)返回的List的容量将始终为1
        List<Integer> integerList = Collections.singletonList(1);
        //Collections.singletonList()返回的是一个不可变的list，对其进行remove操作、add操作都会报错
        integerList.add(2);
        integerList.remove(0);
    }
}
